<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Đặng Khánh Trung
 * Date: 11/2/12
 * Time: 11:33 AM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();

$nhatkyhethongs = $this->get('nhatkyhethongs');
$canbo = $this->get('canbo');
$phongs = $this->get('phong');
if (count($phongs) > 1) 
    $phong = $phongs[0];
elseif (count($phongs) == 1)
    $phong = $phongs;
$donvis = $this->get('donvi');
if (count($donvis) > 1)
    $donvi = $donvis[0];
elseif (count($donvis) == 1)
    $donvi = $donvis;
$khoi = $this->get('khoi');
$hosocanbo = VastHelper::getHosocanbo();
$pagination = $this->get('pagination');
if (!(JFactory::getUser()->authorise('vast.nhatkyhethong.view.own', 'com_vast') && $hosocanbo != NULL && $hosocanbo->id == $canbo->id)) 
{
    JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_vast&view=vast'));            
}

?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Cơ cấu tổ chức</span> »
        <?php if (isset($khoi)): ?>        
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvitructhuoc&id=' . $khoi->id); ?>"><?php echo $khoi->ten ?></a> »                
        <?php endif; ?>
        <?php if (isset($donvi)): ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phongtructhuocs&id=' . $donvi->id); ?>"><?php echo $donvi->ten ?></a> »
        <?php endif; ?>
        <?php if (isset($phong)): ?>
        <span><?php echo $phong->ten; ?></span> »        
        <?php endif; ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietcanbo&id=' . $canbo->id); ?>"><?php echo $canbo->hoten; ?></a> »
        <span>Xem nhật ký hệ thống cá nhân</span>
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">Tra cứu thông tin hoạt động hệ thống của cán bộ <?php echo $canbo->hoten; ?></h3>
    
    <div>
        <table id="rounded-corner">
            <thead>
                <tr>
                    <th scope="col" class="rounded-company" style="width: 60px;"><a href="#ip">Địa chỉ IP</a></th>
                    <th scope="col" class="rounded-q1"><a href="#thoigian">Thời gian</a></th>
                    <th scope="col" class="rounded-q2"><a href="#mota">Mô tả</a></th>
                    <th scope="col" class="rounded-q3" style="width: 100px;"><a href="#nguoidung">Người dùng</a></th>                    
                    <th scope="col" class="rounded-q4"><a href="#hosocanbo">Cán bộ</a></th>                    
                </tr>    
    <!--            <tr>
                    <th scope="col" class="rounded-q1" width="30%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="15%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="15%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="20%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="20%"><input type="text"/></th>
                </tr>-->
            </thead>
            <tfoot>
                <tr>
                    <td colspan="4" class="rounded-foot-left">
                        <em>
                        </em>
                    </td>
                    <td class="rounded-foot-right" style="font-size: smaller;">
                    </td>
                </tr>
            </tfoot>
            <tbody>
                <?php foreach ($nhatkyhethongs as $item) { ?>
                    <tr>
                        <td>
                            <?php if (isset($item->ip) && !is_null($item->ip)) echo $item->ip; else echo 'Không có'; ?>
                        </td>
                        <td>
                            <?php if (isset($item->thoigian) && !is_null($item->thoigian)) echo date('d-m-Y', strtotime($item->thoigian)); else echo 'Không có'; ?>
                        </td>
                        <td>
                            <?php if (isset($item->mota) && !is_null($item->mota)) echo $item->mota; else echo 'Không có'; ?>
                        </td>
                        <td>
                            <?php if (isset($item->nguoidung_id) && !is_null($item->nguoidung_id)) echo $item->username; else echo 'Chưa được thiết lập'; ?>
                        </td>
                        <td>
                            <?php if (isset($item->hosocanbo_id) && !is_null($item->hosocanbo_id)) echo $item->hoten; else echo 'Không có'; ?>                        
                        </td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
  
    <div id="tnt_pagination">
        <?php echo $pagination->getPagesLinks(); ?>
    </div>
    
    <div style="float: left; width: 680px; margin-top: 5px;">
        <?php
        if (isset($_SERVER['HTTP_REFERER']))
        {
            $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
            echo '<a title="Quay lại" href="' . $url . '"><span style="left: 600px; position: relative;">&laquo; Quay lại</span></a>';            
        }
        ?>    
    </div>    
</div>